home *** CD-ROM | disk | FTP | other *** search
/ Resource for Source: C/C++ / Resource for Source - C-C++.iso / misc_src / sqlsomdb / sample10 / mainform.frm < prev    next >
Text File  |  1995-11-01  |  23KB  |  729 lines

  1. VERSION 2.00
  2. Begin Form Mainform 
  3.    BackColor       =   &H00FFFFC0&
  4.    Caption         =   "Test SQL-Sombrero VBX - Author Application"
  5.    ClientHeight    =   4725
  6.    ClientLeft      =   1365
  7.    ClientTop       =   525
  8.    ClientWidth     =   7680
  9.    Height          =   5130
  10.    Left            =   1305
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   4725
  13.    ScaleWidth      =   7680
  14.    Top             =   180
  15.    Width           =   7800
  16.    Begin DEMVBXDB SQLVBXDB1 
  17.       Left            =   2820
  18.       Top             =   4020
  19.    End
  20.    Begin ComboBox author_list 
  21.       FontBold        =   -1  'True
  22.       FontItalic      =   0   'False
  23.       FontName        =   "Fixedsys"
  24.       FontSize        =   9
  25.       FontStrikethru  =   0   'False
  26.       FontUnderline   =   0   'False
  27.       Height          =   330
  28.       Left            =   240
  29.       Style           =   2  'Dropdown List
  30.       TabIndex        =   25
  31.       Top             =   120
  32.       Width           =   7095
  33.    End
  34.    Begin CommandButton delbut 
  35.       Caption         =   "Delete Author"
  36.       Height          =   615
  37.       Left            =   6000
  38.       TabIndex        =   24
  39.       Top             =   2040
  40.       Visible         =   0   'False
  41.       Width           =   1335
  42.    End
  43.    Begin CommandButton cancelbut 
  44.       Caption         =   "Cancel"
  45.       Height          =   495
  46.       Left            =   6240
  47.       TabIndex        =   23
  48.       Top             =   3840
  49.       Visible         =   0   'False
  50.       Width           =   855
  51.    End
  52.    Begin CommandButton newrec 
  53.       Caption         =   "Add New"
  54.       Height          =   615
  55.       Left            =   6000
  56.       TabIndex        =   22
  57.       Top             =   1320
  58.       Visible         =   0   'False
  59.       Width           =   1335
  60.    End
  61.    Begin CommandButton updbut 
  62.       Caption         =   "Update Info"
  63.       Height          =   615
  64.       Left            =   6000
  65.       TabIndex        =   21
  66.       Top             =   3120
  67.       Visible         =   0   'False
  68.       Width           =   1335
  69.    End
  70.    Begin CommandButton chgbut 
  71.       Caption         =   "Change Info"
  72.       Height          =   615
  73.       Left            =   6000
  74.       TabIndex        =   20
  75.       Top             =   600
  76.       Visible         =   0   'False
  77.       Width           =   1335
  78.    End
  79.    Begin TextBox Text1 
  80.       Enabled         =   0   'False
  81.       Height          =   285
  82.       Index           =   8
  83.       Left            =   1560
  84.       MaxLength       =   10
  85.       TabIndex        =   19
  86.       Top             =   3480
  87.       Visible         =   0   'False
  88.       Width           =   3855
  89.    End
  90.    Begin TextBox Text1 
  91.       Enabled         =   0   'False
  92.       Height          =   285
  93.       Index           =   7
  94.       Left            =   1560
  95.       MaxLength       =   12
  96.       TabIndex        =   18
  97.       Top             =   3120
  98.       Visible         =   0   'False
  99.       Width           =   3855
  100.    End
  101.    Begin TextBox Text1 
  102.       Enabled         =   0   'False
  103.       Height          =   285
  104.       Index           =   6
  105.       Left            =   1560
  106.       MaxLength       =   2
  107.       TabIndex        =   17
  108.       Top             =   2760
  109.       Visible         =   0   'False
  110.       Width           =   3855
  111.    End
  112.    Begin TextBox Text1 
  113.       Enabled         =   0   'False
  114.       Height          =   285
  115.       Index           =   5
  116.       Left            =   1560
  117.       MaxLength       =   20
  118.       TabIndex        =   16
  119.       Top             =   2400
  120.       Visible         =   0   'False
  121.       Width           =   3855
  122.    End
  123.    Begin TextBox Text1 
  124.       Enabled         =   0   'False
  125.       Height          =   285
  126.       Index           =   4
  127.       Left            =   1560
  128.       MaxLength       =   40
  129.       TabIndex        =   15
  130.       Top             =   2040
  131.       Visible         =   0   'False
  132.       Width           =   3855
  133.    End
  134.    Begin TextBox Text1 
  135.       Enabled         =   0   'False
  136.       Height          =   285
  137.       Index           =   3
  138.       Left            =   1560
  139.       MaxLength       =   12
  140.       TabIndex        =   14
  141.       Top             =   1680
  142.       Visible         =   0   'False
  143.       Width           =   3855
  144.    End
  145.    Begin TextBox Text1 
  146.       Enabled         =   0   'False
  147.       Height          =   285
  148.       Index           =   2
  149.       Left            =   1560
  150.       MaxLength       =   20
  151.       TabIndex        =   13
  152.       Top             =   1320
  153.       Visible         =   0   'False
  154.       Width           =   3855
  155.    End
  156.    Begin TextBox Text1 
  157.       Enabled         =   0   'False
  158.       Height          =   285
  159.       Index           =   1
  160.       Left            =   1560
  161.       MaxLength       =   40
  162.       TabIndex        =   12
  163.       Top             =   960
  164.       Visible         =   0   'False
  165.       Width           =   3855
  166.    End
  167.    Begin TextBox Text1 
  168.       Enabled         =   0   'False
  169.       Height          =   285
  170.       Index           =   0
  171.       Left            =   1560
  172.       MaxLength       =   11
  173.       TabIndex        =   11
  174.       Top             =   600
  175.       Visible         =   0   'False
  176.       Width           =   3855
  177.    End
  178.    Begin CommandButton exitbut 
  179.       Caption         =   "Exit"
  180.       Height          =   375
  181.       Left            =   4200
  182.       TabIndex        =   1
  183.       Top             =   3960
  184.       Width           =   1095
  185.    End
  186.    Begin CommandButton multibut 
  187.       Caption         =   "Logon"
  188.       Height          =   375
  189.       Left            =   1320
  190.       TabIndex        =   0
  191.       Top             =   3960
  192.       Width           =   1095
  193.    End
  194.    Begin Shape Shape2 
  195.       BorderWidth     =   3
  196.       Height          =   2295
  197.       Left            =   5880
  198.       Top             =   480
  199.       Visible         =   0   'False
  200.       Width           =   1575
  201.    End
  202.    Begin Shape Shape1 
  203.       BorderWidth     =   3
  204.       Height          =   1455
  205.       Left            =   5880
  206.       Top             =   3000
  207.       Visible         =   0   'False
  208.       Width           =   1575
  209.    End
  210.    Begin Label Label1 
  211.       Alignment       =   1  'Right Justify
  212.       BackColor       =   &H00FFFFC0&
  213.       Caption         =   "Postal Code :"
  214.       Height          =   255
  215.       Index           =   8
  216.       Left            =   120
  217.       TabIndex        =   10
  218.       Top             =   3480
  219.       Visible         =   0   'False
  220.       Width           =   1215
  221.    End
  222.    Begin Label Label1 
  223.       Alignment       =   1  'Right Justify
  224.       BackColor       =   &H00FFFFC0&
  225.       Caption         =   "Country :"
  226.       Height          =   255
  227.       Index           =   7
  228.       Left            =   120
  229.       TabIndex        =   9
  230.       Top             =   3120
  231.       Visible         =   0   'False
  232.       Width           =   1215
  233.    End
  234.    Begin Label Label1 
  235.       Alignment       =   1  'Right Justify
  236.       BackColor       =   &H00FFFFC0&
  237.       Caption         =   "State :"
  238.       Height          =   255
  239.       Index           =   6
  240.       Left            =   120
  241.       TabIndex        =   8
  242.       Top             =   2760
  243.       Visible         =   0   'False
  244.       Width           =   1215
  245.    End
  246.    Begin Label Label1 
  247.       Alignment       =   1  'Right Justify
  248.       BackColor       =   &H00FFFFC0&
  249.       Caption         =   "City :"
  250.       Height          =   255
  251.       Index           =   5
  252.       Left            =   120
  253.       TabIndex        =   7
  254.       Top             =   2400
  255.       Visible         =   0   'False
  256.       Width           =   1215
  257.    End
  258.    Begin Label Label1 
  259.       Alignment       =   1  'Right Justify
  260.       BackColor       =   &H00FFFFC0&
  261.       Caption         =   "Address :"
  262.       Height          =   255
  263.       Index           =   4
  264.       Left            =   120
  265.       TabIndex        =   6
  266.       Top             =   2040
  267.       Visible         =   0   'False
  268.       Width           =   1215
  269.    End
  270.    Begin Label Label1 
  271.       Alignment       =   1  'Right Justify
  272.       BackColor       =   &H00FFFFC0&
  273.       Caption         =   "Phone # :"
  274.       Height          =   255
  275.       Index           =   3
  276.       Left            =   120
  277.       TabIndex        =   5
  278.       Top             =   1680
  279.       Visible         =   0   'False
  280.       Width           =   1215
  281.    End
  282.    Begin Label Label1 
  283.       Alignment       =   1  'Right Justify
  284.       BackColor       =   &H00FFFFC0&
  285.       Caption         =   "First Name :"
  286.       Height          =   255
  287.       Index           =   2
  288.       Left            =   120
  289.       TabIndex        =   4
  290.       Top             =   1320
  291.       Visible         =   0   'False
  292.       Width           =   1215
  293.    End
  294.    Begin Label Label1 
  295.       Alignment       =   1  'Right Justify
  296.       BackColor       =   &H00FFFFC0&
  297.       Caption         =   "Last Name :"
  298.       Height          =   255
  299.       Index           =   1
  300.       Left            =   120
  301.       TabIndex        =   3
  302.       Top             =   960
  303.       Visible         =   0   'False
  304.       Width           =   1215
  305.    End
  306.    Begin Label Label1 
  307.       Alignment       =   1  'Right Justify
  308.       BackColor       =   &H00FFFFC0&
  309.       Caption         =   "Author Id :"
  310.       Height          =   255
  311.       Index           =   0
  312.       Left            =   120
  313.       TabIndex        =   2
  314.       Top             =   600
  315.       Visible         =   0   'False
  316.       Width           =   1215
  317.    End
  318. End
  319.  
  320.  
  321. Dim t(1 To 3) As String
  322.  
  323. Sub author_list_Click ()
  324.     show_author
  325.     chgbut.Visible = True
  326.     delbut.Visible = True
  327. End Sub
  328.  
  329. Sub cancelbut_Click ()
  330.     author_list.Enabled = True
  331.     If author_list.ListIndex <> -1 Then
  332.     chgbut.Visible = True
  333.     delbut.Visible = True
  334.     End If
  335.     updbut.Visible = False
  336.     newrec.Visible = True
  337.     cancelbut.Visible = False
  338.     For i = 0 To 8
  339.     text1(i).Enabled = False
  340.     Next
  341.     show_author
  342. End Sub
  343.  
  344. Sub chgbut_Click ()
  345.     For i = 1 To 8
  346.        text1(i).Enabled = True
  347.     Next
  348.     author_list.Enabled = False
  349.     chgbut.Visible = False
  350.     updbut.Visible = True
  351.     newrec.Visible = False
  352.     delbut.Visible = False
  353.     cancelbut.Visible = True
  354.     updflag = 1
  355.     text1(1).SetFocus
  356. End Sub
  357.  
  358.     Sub delbut_Click ()
  359.     updflag = 3
  360.     updbut.Visible = True
  361.     chgbut.Visible = False
  362.     newrec.Visible = False
  363.     cancelbut.Visible = True
  364.     delbut.Visible = False
  365.     author_list.Enabled = False
  366. End Sub
  367.  
  368. Sub exitbut_Click ()
  369.     If dbconn <> 0 Then
  370.     SqlClose (dbconn)
  371.     End If
  372.     sqlwinexit
  373.     sqlexit
  374.     End
  375. End Sub
  376.  
  377. Sub Form_Load ()
  378.     updflag = 0
  379. End Sub
  380.  
  381. Sub multibut_Click ()
  382.     logon.Show 1
  383.     If multibut.Visible = True Then
  384.     Exit Sub
  385.     End If
  386.     newrec.Visible = True
  387.     
  388. '   Once the user has logged on to the server the list box will be
  389. '   populated with a list of the Author Id, Last Name, and First Name
  390. '
  391. '   The first function is to place the SQL Statement required to get
  392. '   this information from the server into the command buffer using
  393. '   the SqlCmd function
  394.  
  395.     ret = SqlCmd(dbconn, "select 'Author Id' = au_id , 'Last Name' = au_lname , 'First Name' = au_fname  from authors")
  396.     If ret = 1 Then
  397.  
  398. '   The SqlExec function is then used to send the SQL Statement to the
  399. '   server for execution. It is at this point that syntax checking is
  400. '   performed
  401.  
  402.     ret = SqlExec(dbconn)
  403.     If ret = 1 Then
  404.         
  405. '   If the command syntax was correct the command will be executing at
  406. '   the server now. The next function is the SqlResults function. This
  407. '   function will return once the processing is complete on the server.
  408. '
  409. '   If the SqlCmd function had been passed more than one SQL command then
  410. '   you must perform a SqlResults for each result set being sent back.
  411. '   The end of result sets will be indicated by a NOMORERESUTLS(2) return
  412. '   from SqlResults
  413.  
  414.         ret = SqlResults(dbconn)
  415.         If ret = 1 Then
  416.  
  417. '   Once the SqlResults returns with the indication that a result set
  418. '   is available we can get the number of columns in the result set. In
  419. '   this application this function is not required since we know how
  420. '   many columns were requested. If the application allowed for AdHoc
  421. '   SQL requests then this function is used to indicate the number of
  422. '   columns of data available.
  423.  
  424.         cols% = SqlNumCols(dbconn)
  425.  
  426. '   To get the column headings we use the SqlColName function. This function
  427. '   will return either the column name based on the internal column name or
  428. '   if the syntax 'Column Name' = colname is used to override the internal
  429. '   column name. In our example we have chosen to override the column name
  430.  
  431.         For c% = 1 To cols%
  432.             colnam$ = SqlColName(dbconn, c%)
  433.         Next
  434.  
  435. '   Once the result set is available for processing each row needs to be
  436. '   retrieved. This is accomplished by calling SqlNextRow until the function
  437. '   returns NOMOREROWS(-2)
  438.  
  439.         ret = SqlNextRow(dbconn)
  440.         While ret <> NOMOREROWS
  441.  
  442. '   For each column in the result set we call the function SqlData to
  443. '   get the data returned for the column. The data returned is a string
  444. '   representation of the data in the result column. The data is right
  445. '   trimmed when returned. The data when return is being concatonated
  446. '   with tabs (chr(9)) between each item to populate the drop down list
  447. '   box with three columns
  448.             
  449.             For c% = 1 To cols%
  450.             t(c%) = SqlData(dbconn, c%)
  451.             Next
  452.             aitem$ = t(1) & Space(15 - Len(t(1))) & Left(t(2) & Space(41 - Len(t(2))), 20) & t(3)
  453.             author_list.AddItem aitem$
  454.             ret = SqlNextRow(dbconn)
  455.         Wend
  456.         End If
  457.     End If
  458.     End If
  459.     If ret <> NOMOREROWS Then
  460.     Exit Sub
  461.     End If
  462.     For i = 0 To 8
  463.     label1(i).Visible = True
  464.     text1(i).Visible = True
  465.     Next
  466.     author_list.Visible = True
  467.     newrec.Visible = True
  468.     shape1.Visible = True
  469.     shape2.Visible = True
  470. End Sub
  471.  
  472. Sub newrec_Click ()
  473.     updflag = 2
  474.     updbut.Visible = True
  475.     chgbut.Visible = False
  476.     newrec.Visible = False
  477.     cancelbut.Visible = True
  478.     delbut.Visible = False
  479.     author_list.Enabled = False
  480.     For i = 0 To 8
  481.     text1(i).Enabled = True
  482.     text1(i).Text = ""
  483.     Next
  484.     text1(0).SetFocus
  485. End Sub
  486.  
  487. Function process_no_rows () As Integer
  488.  
  489. '   If the SQL Statement was successfully placed into the command buffer then
  490. '   send the command to the server for execution.
  491.  
  492.     ret = SqlExec(dbconn)
  493.     If ret = 1 Then
  494.  
  495. '   The SqlResults function will wait until the function is complete on
  496. '   the server. A return of 1 indicates that the statement has been executed
  497. '   on the server
  498.  
  499.     ret = SqlResults(dbconn)
  500.     If ret = 1 Then
  501.  
  502. '   In the case of a delete there are no rows returned in the result set
  503. '   the SqlRows command will confirm that no rows were returned.
  504.  
  505.         ret = SqlRows(dbconn)
  506.         If ret = 1 Then
  507.         MsgBox "This command should not return rows"
  508.         Else
  509.         If updflag = 1 Then
  510.             MsgBox "Information changed for au_id " & text1(0).Text
  511.         Else
  512.             If updflag = 2 Then
  513.             MsgBox "Information added for au_id " & text1(0).Text
  514.             Else
  515.             MsgBox "Information deleted for au_id " & text1(0).Text
  516.             End If
  517.         End If
  518.         End If
  519.     Else
  520.         process_no_rows = ret
  521.         Exit Function
  522.     End If
  523.     Else
  524.     process_no_rows = ret
  525.     End If
  526.     process_no_rows = 99
  527. End Function
  528.  
  529. Sub show_author ()
  530.     lc = author_list.ListIndex
  531.     If lc = -1 Then
  532.     Exit Sub
  533.     End If
  534.     d$ = RTrim(Left(author_list.List(lc), 15))
  535. '
  536. '   Once the author has been selected from the list of authors
  537. '   process a SQL Statement which will select all the fields
  538. '   from the authors table for the author selected from the list
  539. '   by using the where clause on the primary key of the table
  540. '
  541. '   The checking the ret variable for 1 indicates a test for a
  542. '   success. If the ret variable contains a 0 then the function
  543. '   failed
  544.  
  545.     ret = SqlCmd(dbconn, "select * from authors where au_id = " & Chr(34) & d$ & Chr$(34))
  546.     If ret = 1 Then
  547.     
  548. '   If the command was accepted into the buffer in the statement above
  549. '   then send it to the server for execution. If there are syntax
  550. '   errors in the statement then they will be found in the SqlExec step
  551.  
  552.     ret = SqlExec(dbconn)
  553.     If ret = 1 Then
  554.  
  555. '   If the command syntax was correct the command will be executing at
  556. '   the server now. The next function is the SqlResults function. This
  557. '   function will return once the processing is complete on the server.
  558. '
  559. '   If the SqlCmd function had been passed more than one SQL command then
  560. '   you must perform a SqlResults for each result set being sent back.
  561. '   The end of result sets will be indicated by a NOMORERESUTLS(2) return
  562. '   from SqlResults
  563.  
  564.         ret = SqlResults(dbconn)
  565.         If ret = 1 Then
  566.  
  567. '   Once the result set is available for processing each row needs to be
  568. '   retrieved. This is accomplished by calling SqlNextRow until the function
  569. '   returns NOMOREROWS(-2)
  570.  
  571.         ret = SqlNextRow(dbconn)
  572.         While ret <> NOMOREROWS
  573.  
  574. '   For each column in the result set we call the function SqlData to
  575. '   get the data returned for the column. The data returned is a string
  576. '   representation of the data in the result column. The data is right
  577. '   trimmed when returned.
  578.  
  579.             For c% = 1 To 9
  580.             dat$ = SqlData(dbconn, c%)
  581.             text1(c% - 1).Text = dat$
  582.             Next
  583.             ret = SqlNextRow(dbconn)
  584.         Wend
  585.         End If
  586.     End If
  587.     End If
  588. End Sub
  589.  
  590. Sub SQLVBXDB1_ERROR (Sqlconn As Integer, Severity As Integer, ErrorNum As Integer, OsError As Integer, ErrorStr As String, OsErrorStr As String, RetCode As Integer)
  591.  
  592. '   This is a SQL Server callback routine
  593. '
  594. '   When the server needs to inform the user of a error this callback is
  595. '   called. For example if the user tries to logon to a server which does
  596. '   not exist then the error message string (errorstr) will contain text
  597. '   indicating that a connection with the requested server cannot be made.
  598. '   It is also this routine which is called when syntax errors are discovered
  599. '   in SQL commands submitted for execution.
  600.  
  601.     MsgBox ErrorStr
  602. End Sub
  603.  
  604. Sub SQLVBXDB1_MESSAGE (Sqlconn As Integer, Message As Long, State As Integer, Severity As Integer, msgstr As String, ServerName As String, ProcName As String, LineNum As Integer)
  605.  
  606. '   This is a SQL Server callback routine
  607. '
  608. '   When the server needs to inform the user of a status change this callback is
  609. '   used. For example when the user changes databases using the SqlUse function
  610. '   this event procedure will be called and the message string (msgstr) will
  611. '   contain text indicating the new database name.
  612. '   The variable severity can be used to filter the messages so that only messages
  613. '   which need to be seen can be displayed to the user
  614.  
  615.     MsgBox msgstr
  616. End Sub
  617.  
  618. Sub Text1_KeyPress (index As Integer, keyascii As Integer)
  619.     If updflag = 0 Then
  620.     keyascii = 0
  621.     End If
  622. End Sub
  623.  
  624. Sub updbut_Click ()
  625.     Dim sql As String
  626.     If updflag = 3 Then
  627.     GoTo dontcheck
  628.     End If
  629.     If text1(0).Text = "" Then
  630.     MsgBox "Author Id cannot be NULL"
  631.     Exit Sub
  632.     End If
  633.     If text1(1).Text = "" Then
  634.     MsgBox "Last name cannot be NULL"
  635.     Exit Sub
  636.     End If
  637.     If text1(2).Text = "" Then
  638.     MsgBox "First name cannot be NULL"
  639.     Exit Sub
  640.     End If
  641.     If text1(3).Text = "" Then
  642.     MsgBox "Phone # cannot be NULL"
  643.     Exit Sub
  644.     End If
  645.  
  646. dontcheck:
  647.  
  648.     If updflag = 1 Then
  649.  
  650. '   In this application if the updflag is set to 1 then we are modifing the
  651. '   data for a particular row in the table authors. The following code will
  652. '   create a SQL Statement to 'UPDATE' the authors table where the au_id field
  653. '   is equal to the requested author id.
  654.  
  655.     sql = "update authors set "
  656.     sql = sql & " au_lname = " & Chr(34) & text1(1).Text & Chr(34) & " ,"
  657.     sql = sql & " au_fname = " & Chr(34) & text1(2).Text & Chr(34) & " ,"
  658.     sql = sql & " phone = " & Chr(34) & text1(3).Text & Chr(34) & " ,"
  659.     sql = sql & " address = " & Chr(34) & text1(4).Text & Chr(34) & " ,"
  660.     sql = sql & " city = " & Chr(34) & text1(5).Text & Chr(34) & " ,"
  661.     sql = sql & " state = " & Chr(34) & text1(6).Text & Chr(34) & " ,"
  662.     sql = sql & " country = " & Chr(34) & text1(7).Text & Chr(34) & " ,"
  663.     sql = sql & " postalcode = " & Chr(34) & text1(8).Text & Chr(34)
  664.     sql = sql & " where au_id = " & Chr(34) & text1(0).Text & Chr(34)
  665.     Else
  666.     If updflag = 2 Then
  667.  
  668. '   In this application if the updflag is set to 2 then we are adding
  669. '   data for a particular row in the table authors. The following code will
  670. '   create a SQL Statement to 'INSERT' a row into the authors table where the
  671. '   au_id field is equal to the requested author id.
  672.  
  673.     sql = "insert authors values ("
  674.     For i = 0 To 7
  675.         sql = sql & Chr(34) & text1(i).Text & Chr(34) & " , "
  676.     Next
  677.     sql = sql & "convert(bit," & Chr(34) & text1(8).Text & Chr(34) & "))"
  678.       Else
  679.  
  680. '   In this application if the updflag is set to 3 then we are deleting
  681. '   an author record from the table
  682. '   The SQL statement will delete a row from the table based on the
  683. '   primary key (au_id)
  684.  
  685.         sql = "delete from authors where au_id = " & Chr(34) & text1(0).Text & Chr(34)
  686.     
  687.     End If
  688.     End If
  689.  
  690.  
  691.     ret = SqlCmd(dbconn, sql)
  692.     If ret = 1 Then
  693.  
  694. '   If the command was successfully placed in the command buffer then call
  695. '   the subroutine to process a SQL Statement with no rows being returned
  696.  
  697.     ret = process_no_rows()
  698.     End If
  699.  
  700.     If ret = 99 Then
  701.     If updflag = 2 Then
  702.         aitem$ = text1(0).Text & Space(15 - Len(text1(0).Text)) & Left(text1(1).Text & Space(41 - Len(text1(1).Text)), 20) & text1(2).Text
  703.         author_list.AddItem aitem$
  704.         author_list.ListIndex = author_list.ListCount - 1
  705.     Else
  706.         If updflag = 1 Then
  707.         aitem$ = text1(0).Text & Space(15 - Len(text1(0).Text)) & Left(text1(1).Text & Space(41 - Len(text1(1).Text)), 20) & text1(2).Text
  708.         lc = author_list.ListIndex
  709.         author_list.List(lc) = aitem$
  710.         Else
  711.         lc = author_list.ListIndex
  712.         author_list.RemoveItem lc
  713.         author_list.ListIndex = 0
  714.         End If
  715.     End If
  716.     End If
  717.  
  718.     author_list.Enabled = True
  719.     chgbut.Visible = True
  720.     updbut.Visible = False
  721.     newrec.Visible = True
  722.     cancelbut.Visible = False
  723.     delbut.Visible = True
  724.     For i = 0 To 8
  725.     text1(i).Enabled = False
  726.     Next
  727. End Sub
  728.  
  729.